package com.spark.lola.logistics.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.spark.lola.logistics.entity.OrderProduct;
import com.spark.lola.logistics.mapper.LogisticsOrderProductMapper;
import com.spark.lola.logistics.service.LogisticsOrderProductService;
import com.spark.lola.support.mybatis.service.impl.BaseServiceImpl;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @author: Zhi-peng wang
 * @date: 2020/04/28 14:13
 **/
@Service
public class LogisticsOrderProductServiceImpl extends BaseServiceImpl<LogisticsOrderProductMapper, OrderProduct> implements LogisticsOrderProductService {

    public List<OrderProduct> findByOrderId(long orderId) {
        if (orderId != 0) {
            QueryWrapper<OrderProduct> queryWrapper = new QueryWrapper<>();
            queryWrapper.eq("order_id", orderId);
            return this.list(queryWrapper);
        }
        return new ArrayList<>();
    }

}
